<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">

    </div>
    <template id="iswho">
        <div>
            <h3>这是使用extend创建出来的组件</h3>
            <h4>propsData:{{news}}</h4>
        </div>
    </template>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.12/vue.js"></script>
    <script>
        /* 通过extend扩展一个新的组件 */
        var myextend = Vue.extend({
            template:'#iswho',
            //需要通过props来接收,接收的名称的和propsData的key相同
            props: ['news']
        })
        //实例化对象,在里面传递数据
        new myextend({
            propsData:{
                'news':'这个就是propsData传递的数据'
            }
        }).$mount('#app');

    </script>
    
</body>
</html>